<template>
 <div>
    <el-dialog
        title="设置公司标签"
        :visible.sync="esitTagBoolean"
        width="880"
        custom-class="dialogClassTag"
		:select="select"
        :before-close="handleClose">
        <el-scrollbar>
            <div class="d-flex" style="height: 100%;">
                <div class="selectMenu">
                    <div class="menu" :class="{active: item.isActive}" v-for="(item, index) in select" :key="index" @click="checkMenu(item, index, 1)">
                        <div class="selector-item" :title="item.name">
                            {{item.name}}
                        </div>
                    </div>
                </div>
                <div class="selectMenu">
                    <div class="menu" :class="{active: item.isActive}" v-for="(item, index) in twoMenu" :key="index" @click="checkMenu(item, index, 2)">
                        <div class="selector-item" :title="item.name">{{item.name}}</div>
                    </div>
                </div>
                <div class="selectMenu" style="border: none;">
                    <div class="menu" :class="{active: item.isActive}" v-for="(item, index) in  threeMenu" :key="index" @click="checkTag(item, index)">
                        {{item.name}} &nbsp;&nbsp;&nbsp;<i class="el-icon-check" v-if="item.isActive"></i>
                    </div>
                </div>
      
            </div>
        </el-scrollbar>
        <hr>
        <div class="tag-group">
            <span class="tag-group__title">已选择：({{haveTag.length}}/3)</span>
            <div class="elTag">
                <el-tag
                    v-for="(item,index) in haveTag"
                    :key="index"
                    closable
                    @close="closeTag(item)"
                    size="medium"
                    effect="plain">
                    {{ item.name }}
                </el-tag>
            </div>
        </div>
        <span slot="footer" class="dialog-footer">
           <!-- <el-button @click="center">取 消</el-button> -->
            <el-button type="primary" @click="confirm">确认</el-button>
        </span>
    </el-dialog>
 </div>
</template>


<script>
  export default {
    name: 'setCompanyLabel',
    props: {
        esitTagBoolean: {
            type: Boolean,
            default: false
        },
		select: {
		    type: Array
		}
		
    },
    data() {
      return {
		 twoMenu:[],
		 threeMenu:[],
		 haveTag:[]
       }
    },
    mounted () {
       console.log(this.select)
    },
    methods: {
      handleClose(done) {
        this.$emit('close', false)
        this.closeAll()
      },
      center () {
        this.$emit('close', false)
        this.closeAll()
      },
      confirm () {
          this.$emit('confirmHaveTag', this.tagArrs)
      },
      checkMenu (items, index, flag) {
          
      },
      //  多选标签
      checkTag (val,index) {
        
	
      },
        //  关闭已选择的标签
       closeTag (velData) {
           
       }
      
    }
  };
</script>
<style scoped>
    .companyTag{
        margin-top: 10px;
        display: flex;
        /* justify-content: space-between; */
        flex-wrap:wrap;
        flex-direction: row;
        max-height: 337px;
    }
    .companyTag .tag {
        height: 23px;;
        display: inline-block;
        padding: 3px 20px;
        margin: 4px 6px;
        font-size:12px;
        font-family:PingFang SC;
        font-weight:400;
        text-align: center;
        line-height: 23px;
        cursor: pointer;
        color:rgba(85,85,85,1);
    }
    .selectTagClass{
        /* border:1px solid rgba(24,147,252,1)!important; */
        color: rgba(24,147,252,1) !important;
        position: relative;
    }
    hr{
        margin-bottom: 23px;
        background:rgba(232,232,232,1);
    }

    .tag-group{
        display: flex;
        padding: 0 20px;
    }
    .tag-group__title{
        font-size:14px;
        font-family:PingFang SC;
        font-weight:400;
        line-height:20px;
        color:rgba(34,34,34,1)
    }

    .elTag{
        display: flex;
        flex-wrap:wrap;
        flex-direction: row;
        width: 75%;
    }
    .elTag /deep/ .el-tag--plain {
        margin: 0px 10px 16px;
        padding: 0 5px;
        font-size:12px;
        text-align: center;
        font-family:PingFang SC;
        font-weight:400;
        /* padding: 2px 0; */
        color:rgba(24,147,252,1);
    }


    .dialog-footer button {
        width:120px;
        height:34px;
    }
    .dialog-footer .el-button--default {
        margin-right: 20px;
    }
    /* 自定义 */
    .custom .esitTag{
        display: flex;
        align-items: center;
        color: #0093FF;
    }
    .selectMenu {
        height: 100%;
        border-right: 1px solid rgba(232,232,232,1);
    }
    .active {
        color: #1e9bf5;
        background-color: #f1f8ff;
    }
    .selectMenu .menu {
		width: 196px;
        height: 40px;
		text-align: center;
        line-height: 40px;
        cursor: pointer;
        
        /* width: 100%; */
    }
    .selector-item {
        display: inline-block;
        vertical-align: middle;
        white-space: nowrap;
        overflow: hidden;
        -o-text-overflow: ellipsis;
        text-overflow: ellipsis;
    }
    .d-flex {
        display: flex;
    }
    .flex-1 {
        flex: 1;
    }
   /* ::-webkit-scrollbar {
        display: none;
    } */
</style>
<style>
    .dialogClassTag .el-dialog__body {
        padding: 0;
    }
    .dialogClassTag .el-scrollbar__view {
        height: 540px;
    }
    .dialogClassTag .el-dialog__header{
        border-bottom: 1px solid rgba(0,147,255,1);
    }
   .dialogClassTag  .el-dialog__headerbtn .el-dialog__close {
        color: rgba(0,147,255,1);
    }
    .dialogClassTag .el-dialog__title {
        font-size:16px;
        font-family:PingFang SC;
        font-weight:600;
        line-height:16px;
        margin-top: 4px;
        color:rgba(34,34,34,1);
   }
</style>